﻿using Basic.UserRemoteModel.User.Model;
using Shop.StoreGatewayModular.Interface;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Client;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Api
{
    [ApiRouteName("/shop/user/{name}")]
    internal class UserApi : ApiController
    {
        private readonly IUserService _Service;

        public UserApi (IUserService service)
        {
            this._Service = service;
        }

        public void Disable ([NumValidate("user.id.error", 1)] long userId)
        {
            this._Service.Disable(userId);
        }

        public void Enable ([NumValidate("user.id.error", 1)] long userId)
        {
            this._Service.Enable(userId);
        }

        public UserData Get ([NumValidate("user.id.error", 1)] long id)
        {
            return this._Service.Get(id);
        }

        public PagingResult<UserData> Query (PagingParam<UserQueryParam> param)
        {
            return this._Service.Query(param);
        }
    }
}
